import { http } from "@/utils/http";

export type commonResult<T> = {
  code: number;
  msg: string;
  result: T;
};

export type infoType = {

	VR?: string,
	isDefault?: number,
	topoId?: number,
	showMode?: number,
	drawingName?: string,
	projectId?: number,
	buildingId?: number,
	img?: string,
	id?: number,
}
export type infoTypeList = {
  data: infoType[];
  total: number;
};

const List = '/business/project/drawing/v2/draws';
const Url = '/business/project/drawing/v2/drawing';
export const getList = (params?: object) => {
  return http.request<commonResult<infoTypeList>>("get", List, {
    params
  });
};
export const getInfo = (params?: object) => {
  return http.request<commonResult<infoType>>("get", Url, {
    params
  });
};
export const addInfo = (data?: object) => {
  return http.request<commonResult<any>>("post", Url, {
    data
  });
};
export const editInfo = (data?: object) => {
  return http.request<commonResult<any>>("put", Url, {
    data
  });
};
export const deleteInfo = (data?: object) => {
  return http.request<commonResult<any>>("delete", Url, {
    data
  });
};

//上传图纸
export const importFlowCard = (data?: object) => {
  return http.request<commonResult<any>>("post", '/business/project/drawing/v2/upload', {
    data,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  });
};
export const importdraw = (data?: object) => {
  return http.request<commonResult<any>>("post", '/business/project/drawing/v2/import', {
    data,

  });
};
//上传图纸
export const darwTree = (params?: object) => {
  return http.request<commonResult<any>>("get", '/business/project/drawing/v2/draw', {
    params
  });
};
/** 2.5.4.1图纸管理建筑列表 */

export const darwTreeList = (params?: object) => {
  return http.request<commonResult<any>>("get", '/business/project/drawing/v2/buildings', {
    params
  });
};
/** 2.5.4.1图纸管理建筑列表 */

export const darwUpDown = (data?: object) => {
  return http.request<commonResult<any>>("put", '/business/project/drawing/v2/up-down', {
    data
  });
};
